import store from '@/store'
// 当dom加载后执行inserted
// el:是使当前指令的哪个标签
// binding主要用的是binding.value,存了使用v-imgerror的值
export const imgerror = { inserted(el, binding) {
  el.onerror = function() {
    el.src = binding.value
  }
}
}

export const color = {
  inserted(el, binding) {
    el.style.color = binding.value
  }
}

export const permission = {
  inserted(el, binding) {
    const points = store.getters.roles.points
    if (!points.includes(binding.value)) {
      // el.style.display = 'none'
      el.parentNode.removeChild(el)
    }
  }
}
